home *** CD-ROM | disk | FTP | other *** search
-
-
-
- RRRRWWWWCCCCaaaacccchhhheeeeMMMMaaaannnnaaaaggggeeeerrrr((((3333CCCC++++++++)))) RRRRWWWWCCCCaaaacccchhhheeeeMMMMaaaannnnaaaaggggeeeerrrr((((3333CCCC++++++++))))
-
-
-
- NNNNaaaammmmeeee
- RWCacheManager - Rogue Wave library class
-
- SSSSyyyynnnnooooppppssssiiiissss
- #include <rw/cacheman.h>
-
-
-
- RWFile f("file.dat"); // Construct a file
- RWCacheManager(&f, 100); // Cache 100 byte blocks to file.dat
-
-
-
-
- DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
- Class RRRRWWWWCCCCaaaacccchhhheeeeMMMMaaaannnnaaaaggggeeeerrrr caches fixed length blocks to and from an associated
- RRRRWWWWFFFFiiiilllleeee. The block size can be of any length and is set at construction
- time. The number of cached blocks can also be set at construction time.
- Writes to the file may be deferred. Use member function fffflllluuuusssshhhh(((()))) to have
- any pending writes performed.
-
- PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
- None
-
- EEEExxxxaaaammmmpppplllleeee
- #include <rw/cacheman.h>
- #include <rw/rwfile.h>
- struct Record {
- int i;
- float f;
- char str[15];
- };
- main(){
- RWoffset loc;
- RWFile file("file.dat"); // Construct a file
- // Construct a cache, using 20 slots for struct Record:
- RWCacheManager cache(&file, sizeof(Record), 20);
- Record r;
- // ...
- cache.write(loc, &r);
- // ...
- cache.read(loc, &r);
- }
-
- PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr
- RRRRWWWWCCCCaaaacccchhhheeeeMMMMaaaannnnaaaaggggeeeerrrr(RWFile* file, unsigned blocksz,
- unsigned mxblks = 10);
-
-
- Construct a cache for the RRRRWWWWFFFFiiiilllleeee pointed to by ffffiiiilllleeee. The length of the
- fixed-size blocks is given by bbbblllloooocccckkkksssszzzz. The number of cached blocks is
- given by mmmmxxxxbbbbllllkkkkssss. If the total number of bytes cached would exceed the
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- RRRRWWWWCCCCaaaacccchhhheeeeMMMMaaaannnnaaaaggggeeeerrrr((((3333CCCC++++++++)))) RRRRWWWWCCCCaaaacccchhhheeeeMMMMaaaannnnaaaaggggeeeerrrr((((3333CCCC++++++++))))
-
-
-
- maximum value of an unsigned int, then RRRRWWWWCCCCaaaacccchhhheeeeMMMMaaaannnnaaaaggggeeeerrrr will quietly decide
- to cache a smaller number of blocks.
-
- PPPPuuuubbbblllliiiicccc DDDDeeeessssttttrrrruuuuccccttttoooorrrr
- ~RRRRWWWWCCCCaaaacccchhhheeeeMMMMaaaannnnaaaaggggeeeerrrr();
-
-
- Performs any pending I/O operations (iiii....eeee...., calls fffflllluuuusssshhhh(((())))) and deallocates
- any allocated memory.
-
- PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
- RWBoolean
- fffflllluuuusssshhhh();
-
-
- Perform any pending I/O operations. Returns TTTTRRRRUUUUEEEE if the flush was
- successful, FFFFAAAALLLLSSSSEEEE otherwise.
-
- void
- iiiinnnnvvvvaaaalllliiiiddddaaaatttteeee();
-
-
- Invalidate the cache.
-
- RWBoolean
- rrrreeeeaaaadddd(RWoffset locn, void* dat);
-
-
- Return the data located at offset llllooooccccnnnn of the associated RRRRWWWWFFFFiiiilllleeee. The
- data is put in the buffer pointed to by ddddaaaatttt. This buffer must be at
- least as long as the block size specified when the cache was constructed.
- Returns TTTTRRRRUUUUEEEE if the operation was successful, otherwise FFFFAAAALLLLSSSSEEEE.
-
- RWBoolean
- wwwwrrrriiiitttteeee(RWoffset locn, void* dat);
-
-
- Write the block of data pointed to by ddddaaaatttt to the offset llllooooccccnnnn of the
- associated RRRRWWWWFFFFiiiilllleeee. The number of bytes written is given by the block
- size specified when the cache was constructed. The actual write to disk
- may be deferred. Use member function fffflllluuuusssshhhh(((()))) to perform any pending
- output. Returns TTTTRRRRUUUUEEEE if the operation was successful, otherwise FFFFAAAALLLLSSSSEEEE.
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-